package com.example.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DbHelper extends SQLiteOpenHelper {
	 private static final String DATABASE_NAME = "test.db";  
	 private static final int DATABASE_VERSION = 1; 
	public DbHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		 db.execSQL("DROP TABLE IF EXISTS chatmessage"); 
		db.execSQL("CREATE TABLE IF NOT EXISTS chatmessage" +  
                "(id INTEGER PRIMARY KEY AUTOINCREMENT, sendname VARCHAR,recname VARCHAR,sendtime VARCHAE,messcontent VARCHAR)");
		db.execSQL("DROP TABLE IF EXISTS activeinfo"); 
		db.execSQL("CREATE TABLE IF NOT EXISTS activeinfo" +  
                "(id INTEGER PRIMARY KEY AUTOINCREMENT, activename VARCHAR,currentname VARCHAR,leader VARCHAE,parter VARCHAR,location VARCHAR,allip VARCHAR,activetime VARCHAR)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		 db.execSQL("ALTER TABLE person ADD COLUMN other STRING"); 
	}

}
